package com.fastjrun.codeg.plugins;

import com.fastjrun.codeg.javamapper.CustomJavaMapperMethodGenerator;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.codegen.mybatis3.javamapper.elements.AbstractJavaMapperMethodGenerator;

import java.util.List;

public class CustomPlugin extends PluginAdapter {

  @Override
  public boolean validate(List<String> warnings) {
    return true;
  }

  @Override
  public boolean clientGenerated(Interface interfaze, IntrospectedTable introspectedTable) {

    AbstractJavaMapperMethodGenerator methodGenerator = new CustomJavaMapperMethodGenerator();
    methodGenerator.setContext(context);
    methodGenerator.setIntrospectedTable(introspectedTable);
    methodGenerator.addInterfaceElements(interfaze);
    return super.clientGenerated(interfaze, introspectedTable);
  }
}
